package cn.echoedu.control;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import cn.echoedu.command.base.FailureParam;
import cn.echoedu.command.base.SuccessParam;
import cn.echoedu.model.AClassModel;
import cn.echoedu.model.AddFeedBackModel;
import cn.echoedu.model.AppApiModel;
import cn.echoedu.model.ClassNotifyImageModel;
import cn.echoedu.model.ClassNotifyModel;
import cn.echoedu.model.ContactsListModel;
import cn.echoedu.model.DegressModel;
import cn.echoedu.model.DepartmentModel;
import cn.echoedu.model.HomePageImageModel;
import cn.echoedu.model.ImageModel;
import cn.echoedu.model.JobAuthorityModel;
import cn.echoedu.model.PoliticalstatusModel;
import cn.echoedu.model.ProfessionalModel;
import cn.echoedu.model.ReceiveClassNotifyModel;
import cn.echoedu.model.ReceiveSchoolNotifyModel;
import cn.echoedu.model.RequestMessageModel;
import cn.echoedu.model.SchoolCalendarModel;
import cn.echoedu.model.SchoolModel;
import cn.echoedu.model.SchoolNotifyImageModel;
import cn.echoedu.model.SchoolNotifyModel;
import cn.echoedu.model.StudentModel;
import cn.echoedu.model.TeacherModel;
import cn.echoedu.model.TelContactsModel;
import cn.echoedu.model.UserModel;
import cn.echoedu.service.ResponseService;
import cn.echoedu.util.L;
import cn.echoedu.util.WebContext;

public abstract class BaseControl {
	final String T ="BaseControl----";
	public ResponseService getResponseService(){
		return (ResponseService) WebContext.getServletContext().getAttribute("ResponseService");
	}
	public SuccessParam getSuccessParam(HttpServletRequest request,HttpServletResponse response,
			Object param,String token,int code){
		SuccessParam successparam = new SuccessParam();
		successparam.setParam(param);
		successparam.setRequest(request);
		successparam.setResponse(response);
		successparam.setToken(token);
		successparam.setCode(code);
		return successparam;
	}
	public SuccessParam getSuccessParam2(HttpServletRequest request,HttpServletResponse response,
			Object param,int code){
		SuccessParam successparam = new SuccessParam();
		successparam.setParam(param);
		successparam.setRequest(request);
		successparam.setResponse(response);
		successparam.setCode(code);
		return successparam;
	}
	public FailureParam getFailureParam(HttpServletRequest request,
			HttpServletResponse response,Object param){
		FailureParam failureparam = new FailureParam();
		failureparam.setParam(param);
		failureparam.setRequest(request);
		failureparam.setResponse(response);
		return failureparam;
	}
	public DepartmentModel getDepartmentModel() {
		// TODO Auto-generated method stub
		return (DepartmentModel)WebContext.getServletContext()
				.getAttribute("DepartmentModel");
	}
	public ClassNotifyModel getClassNotifyModel(){
		return (ClassNotifyModel)WebContext.getServletContext()
				.getAttribute("ClassNotifyModel");
	}
	public ImageModel getImageModel(){
		return (ImageModel)WebContext.getServletContext()
				.getAttribute("ImageModel");
	}
	public ClassNotifyImageModel getClassNotifyImageModel(){
		final String M  = "getClassNotifyImageModel**********>>>";
		L.p(T+M);
		return (ClassNotifyImageModel)WebContext.getServletContext()
				.getAttribute("ClassNotifyImageModel");
	}
	public ReceiveClassNotifyModel getReceiveClassNotifyModel(){
		return (ReceiveClassNotifyModel)WebContext.getServletContext()
				.getAttribute("ReceiveClassNotifyModel");
	}
	public SchoolNotifyModel getSchoolNotifyModel(){
		return (SchoolNotifyModel)WebContext.getServletContext()
				.getAttribute("SchoolNotifyModel");
	}

	public SchoolNotifyImageModel getSchoolNotifyImageModel(){
		return (SchoolNotifyImageModel)WebContext.getServletContext()
				.getAttribute("SchoolNotifyImageModel");
	}
	public ReceiveSchoolNotifyModel getReceiveSchoolNotifyModel(){
		return (ReceiveSchoolNotifyModel)WebContext.getServletContext()
				.getAttribute("ReceiveSchoolNotifyModel");
	}
	public AClassModel getAClassModel(){
		return (AClassModel)WebContext.getServletContext()
				.getAttribute("AClassModel");
	}
	public JobAuthorityModel getJobAuthorityModel(){
		return (JobAuthorityModel)WebContext.getServletContext()
				.getAttribute("JobAuthorityModel");
	}
	public HomePageImageModel getHomePageImageModel(){
		return (HomePageImageModel)WebContext.getServletContext()
				.getAttribute("HomePageImageModel");
	}

	public TeacherModel getTeacherModel(){
		return (TeacherModel)WebContext.getServletContext()
				.getAttribute("TeacherModel");
	}
	public StudentModel getStudentModel(){
		return (StudentModel)WebContext.getServletContext()
				.getAttribute("StudentModel");
	}
	public SchoolCalendarModel getSchoolCalendarModel(){
		return (SchoolCalendarModel)WebContext.getServletContext()
				.getAttribute("SchoolCalendarModel");
	}
	public ContactsListModel getContactsListModel(){
		return (ContactsListModel) WebContext.getServletContext()
				.getAttribute("ContactsListModel");
	}
	public RequestMessageControl getRequestMessageControl(){
		return new RequestMessageControl();
	}

	public UserModel getUserModel(){
		return (UserModel)WebContext.getServletContext()
				.getAttribute("UserModel");
	}
	public ProfessionalModel getProfessionalModel(){
		return (ProfessionalModel)WebContext.getServletContext()
				.getAttribute("ProfessionalModel");
	}
	public RequestMessageModel getRequestMessageModel(){
		return (RequestMessageModel)WebContext.getServletContext()
				.getAttribute("RequestMessageModel");
	}
	public AppApiModel getAppApiModel(){
		return (AppApiModel)WebContext.getServletContext()
				.getAttribute("AppApiModel");
	}
	 
	public TelContactsModel getTelContactsModel(){
		return (TelContactsModel)WebContext.getServletContext()
				.getAttribute("TelContactsModel");
	}
	 
	public DegressModel getDegressModel(){
		return (DegressModel)WebContext.getServletContext().getAttribute("DegressModel");
	}
	 
	public PoliticalstatusModel getPoliticalstatusModel(){
		return (PoliticalstatusModel)WebContext.getServletContext()
				.getAttribute("PoliticalstatusModel");
	} 
	public SchoolModel getSchoolModel(){
		return (SchoolModel)WebContext.getServletContext()
				.getAttribute("SchoolModel");
	}
	public AddFeedBackModel addFeedBack(){
		return (AddFeedBackModel)WebContext.getServletContext()
				.getAttribute("AddFeedBackModel");
	}
}
